Skip to content

Conversation

erikhfj
Copy link
Member

@erikhfj erikhfj commented Nov 22, 2026

Closes #117

What was done

  • Wrapped the three expect(status).toHaveFocus() assertions in client/src/components/ReviewForm.test.tsx in await waitFor(...), matching the existing pattern in client/src/pages/AlbumDetailPage.test.tsx:351.
  • ReviewForm moves focus to statusRef in a passive useEffect. Previously, await screen.findByRole('status') could resolve via Testing Library's MutationObserver right after React committed the DOM node and before the passive useEffect task ran, causing intermittent failures in CI (run 88055) and local full runs.

What was tested

  • client/src/components/ReviewForm.test.tsx: 10 consecutive runs passed (10/10 tests each).
  • pnpm format:check && pnpm lint && pnpm typecheck && pnpm test: passed (0 lint warnings; client 207 passed, server unit tests passed with DB-backed suites skipped without TEST_DATABASE_URL).

@erikhfj erikhfj requested a review from a team as a code owner November 22, 2026 16:37
@erikhfj erikhfj self-assigned this Nov 22, 2026
Copy link
Member

@robertky robertky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The test now waits for the status element to receive focus after React’s effect runs, which matches the asynchronous focus behavior and avoids a timing-sensitive assertion. No production code changed, and CI passes.

@robertky robertky merged commit 8b9f5d5 into main Nov 22, 2026
3 checks passed
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stabilize ReviewForm status focus test
2 participants